import { useUserStore } from '@/store/system/user';


export default (app) => {
    app.directive('auth', {
        mounted(el, binding) {
            hasAuth(el, binding)
        }
    })
};

const hasAuth = (el, binding) => {
    const { perms } = useUserStore();
    const { value } = binding;
    if (!value) return;
    if(perms.indexOf(value) === -1) {
        el.remove?.()
    };
};